<template>
	<view class="content">
		<!-- <my-component></my-component> -->
		<navbar titleText="首页" :isHome="true"/>
		<i-notice-bar></i-notice-bar>
		<button style="margin-top: 230rpx;" @click="navigateTo">提交</button>
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<ul>
			<li v-for="(item,index) in list" :key="index">{{item.name + item.num}}</li>
		</ul>
		<view>总数：{{totalNum}}</view>
		<button @click="headleClick">提交</button>
	</view>
</template>

<script setup>
	import { ref, reactive, computed } from 'vue'
	let title = ref('321')
	const list = reactive([
		{name:'a', num:1},
		{name:'b', num:2},
		{name:'c', num:3}
	])
	const headleClick = ()=>{
		list.forEach(item=>{
			item.num++
		})
	}
	const totalNum = computed(()=>{
		return list.reduce((total ,cur) => total + cur.num, 0);
	})
	const changeData = (val) =>{
		title.value = val
	}
	
	const navigateTo = () =>{
		uni.navigateTo({
			url:"/pages/search/index"
		})
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
